package com.example.administrator.yunniuusedcar.holder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.common.ui.BaseAdapterRV;
import com.example.administrator.common.ui.BaseHolderRV;
import com.example.administrator.yunniuusedcar.R;
import com.example.administrator.yunniuusedcar.model.mode_benn.WZ_ArticleInfoBean;
import com.squareup.picasso.Picasso;

/**
 * Created by Administrator on 2017/12/18.
 */

public class ContentInfo2_2ActionInfoHolder extends BaseHolderRV<WZ_ArticleInfoBean.Data> {

    private RelativeLayout LLActivityInformage;
    private ImageView ivInfomationPage;
    private View viewColor;
    private TextView tvInfomationTitle;
    private TextView tvInfomationTime;
    private TextView tvInfomationSoure;
    private TextView tvInfomationFrom;

    /**
     * 构造方法
     *
     * @param context 上下文对象
     * @param parent  指RecyclerView控件
     * @param adapter 适配器
     *                d @param layoutResId RecyclerView的一个item布局文件
     */
    public ContentInfo2_2ActionInfoHolder(Context context, ViewGroup parent, BaseAdapterRV<WZ_ArticleInfoBean.Data> adapter) {
        super(context, parent, adapter, R.layout.fragment_choosecar02_information);
    }

    @Override
    public void onFindViews(View itemView) {
        initFindViewBid(itemView);
    }

    private void initFindViewBid(View itemView) {
        LLActivityInformage = itemView.findViewById(R.id.LL_activityInformage);
        ivInfomationPage = itemView.findViewById(R.id.iv_infomationPage);
        viewColor = itemView.findViewById(R.id.view_color);    // 间隔线
        tvInfomationTitle = itemView.findViewById(R.id.tv_infomationTitle);
        tvInfomationTime = itemView.findViewById(R.id.tv_infomationTime);
        tvInfomationSoure = itemView.findViewById(R.id.tv_infomationSoure);
//        tvInfomationFrom = itemView.findViewById(R.id.tv_infomationFrom);




        LLActivityInformage.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //点击item 跳转到 咨询详情 页面

            }
        });
    }

    @Override
    protected void onRefreshView(WZ_ArticleInfoBean.Data bean, int position) {

        Picasso.with(context).load(bean.logo).into(ivInfomationPage);  // tup
        tvInfomationTitle.setText(bean.title);   // 标题
        tvInfomationTime.setText("时间：" + bean.add_time);
        tvInfomationSoure.setText("来源:" + bean.source);
    }


}
